import { httpGet, httpPost, httpPostJSON } from "../service/request";
import { LoginParamsType, RegisterParamsType } from "../types";

// 登录 api
export function login(data: LoginParamsType) {
  return httpPost("health/doctor/v1/login", data);
}
// 科室列表
export function getDepartmentList() {
  return httpGet("health/share/knowledgeBase/v1/findDepartment");
}

// 职称列表
export function getJobList() {
  return httpGet("health/doctor/v1/findJobTitleList");
}

// 邮箱验证码
export function getEmailCode(data: { email: string }) {
  return httpPost("health/doctor/v1/sendEmailCode", data);
}

// 注册
export function register(data: RegisterParamsType) {
  return httpPostJSON("health/doctor/v1/applyJoin", data);
}

// 获取聊天列表
export function getDoctorChatList() {
  return httpGet("/health/doctor/inquiry/verify/v1/findInquiryRecordList", {
    page: 1,
    count: 100,
  });
}

interface SendMessageParamState {
  inquiryId: number | string;
  content: string;
  type: number;
  userId: number | string;
}

// 发送消息
export function sendMessage(params: SendMessageParamState) {
  return httpPost("/health/doctor/inquiry/verify/v1/pushMessage", params);
}

// 获取聊天记录
export function getChathistoryList(data) {
  return httpGet(
    "/health/doctor/inquiry/verify/v1/findInquiryDetailsList",
    data
  );
}
